package cn.xorange.love.service;

import cn.xorange.commons.core.basic.service.BaseService;
import cn.xorange.commons.security.utils.SecurityUtils;
import cn.xorange.commons.utils.configuration.constants.GlobalConstants;
import cn.xorange.love.entity.AppUserCert;
import cn.xorange.love.mapper.AppUserCertMapper;
import com.alibaba.fastjson2.JSON;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;

/**
 * @author : yangjian
 * date : 2024/7/15
 * description :
 */
@Service
public class AppUserCertService extends BaseService<AppUserCert, AppUserCertMapper> {

    public Integer addAuth(String type, Map<String,String> map){
        Long userId = SecurityUtils.getUserId();

        AppUserCert userAuth = new AppUserCert();
        userAuth.setId(userId);
        userAuth.setContents(JSON.toJSONString(map));
        userAuth.setType(type);
        userAuth.setStatus(GlobalConstants.FLAG_EXAMINE_NULL);
        userAuth.setCreateTime(new Date());
        return mapper.insert(userAuth);
    }
}
